/*
 * @(#) Environment.java 2011-4-18
 *
 * Copyright (c) 2011, Strong Technology. All Rights Reserved.
 * Strong Technology. CONFIDENTIAL
 */
package cn.strong.gweva.common.business.entity;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import cn.strong.gweva.common.business.entity.db.JxkhConfigEntity;
import cn.strong.gweva.common.business.entity.db.JxkhLegalDaysEntity;
import cn.strong.gweva.common.util.EntityUtility;


/**
 * 环境变量。
 * 
 * @author HMI
 * @version 1.0
 * @since 2011-4-18
 */
public class Environment
{
	
	/** 写日志 */
	protected static Log log = LogFactory.getLog(Environment.class);

	/** 系统配置信息 */
	public static final JxkhConfigEntity CONFIG = new JxkhConfigEntity();
	
	/** 法定天数 */
	public static final List<JxkhLegalDaysEntity> LEGAL_DAYS_LIST = new ArrayList<JxkhLegalDaysEntity>();
	
	/**
	 * 刷新IP配置信息。
	 * 
	 * @param configEntity
	 */
	public static void refreshConfig(JxkhConfigEntity configEntity)
	{
		EntityUtility.copyEntity(configEntity, Environment.CONFIG);
		log.info("refreshConfig");
	}

	/**
	 * 刷新法定天数。
	 * 
	 * @param configEntity
	 */
	public static void refreshLegalDaysList(List<JxkhLegalDaysEntity> list)
	{
		Environment.LEGAL_DAYS_LIST.clear();
		if (list != null)
		{
			Environment.LEGAL_DAYS_LIST.addAll(list);
		}
		log.info("refreshLegalDaysList");
	}
}
